package com.jake.rabbit.demo.producer;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TopicProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendAccurate(String msg) {
        rabbitTemplate.convertAndSend("jake.topic.exchange", "jake.topic.routingKey.accurate", msg);
    }

    public void sendSingle(String msg) {
        rabbitTemplate.convertAndSend("jake.topic.exchange", "jake.topic.routingKey.only-one-word", msg);
    }

    public void sendAny(String msg) {
        rabbitTemplate.convertAndSend("jake.topic.exchange", "jake.topic.routingKey.as.much.as.you.want", msg);
    }
}
